/**
 * Copyright (c) 2013, 2016 itemis AG (http://www.itemis.eu) and others.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 * 
 * SPDX-License-Identifier: EPL-2.0
 */
package org.eclipse.xtend.core.tests.compiler;

import org.eclipse.xtend2.lib.StringConcatenation;
import org.junit.Test;

/**
 * @author Sebastian Zarnekow - Initial contribution and API
 */
@SuppressWarnings("all")
public class CompilerBug406425Test extends AbstractXtendCompilerTest {
  @Test
  public void testBug406425_01() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import static org.hamcrest.core.Is.*");
    _builder.newLine();
    _builder.append("import static org.junit.Assert.*");
    _builder.newLine();
    _builder.append("import org.hamcrest.Matcher");
    _builder.newLine();
    _builder.append("class Test {");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("def test() {");
    _builder.newLine();
    _builder.append("       ");
    _builder.append("new MyEntity => [");
    _builder.newLine();
    _builder.append("           ");
    _builder.append("assertThat(it, nullValue)");
    _builder.newLine();
    _builder.append("           ");
    _builder.append("assertThat(it.name, is(\"\"))");
    _builder.newLine();
    _builder.append("       ");
    _builder.append("]");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("def static <T> Matcher<T> nullValue() {}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _builder.append("class MyEntity {");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("@Property String name");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.ObjectExtensions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;");
    _builder_1.newLine();
    _builder_1.append("import org.hamcrest.Matcher;");
    _builder_1.newLine();
    _builder_1.append("import org.hamcrest.core.Is;");
    _builder_1.newLine();
    _builder_1.append("import org.junit.Assert;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Test {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public MyEntity test() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("MyEntity _myEntity = new MyEntity();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Procedure1<MyEntity> _function = new Procedure1<MyEntity>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public void apply(final MyEntity it) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Assert.<MyEntity>assertThat(it, Test.<MyEntity>nullValue());");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Assert.<String>assertThat(it.getName(), Is.<String>is(\"\"));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return ObjectExtensions.<MyEntity>operator_doubleArrow(_myEntity, _function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static <T extends Object> Matcher<T> nullValue() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testBug406425_02() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike");
    _builder.newLine();
    _builder.append("class Test<T> {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def m(T a, T b){}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("    ");
    _builder.append("static def m() {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("new StringBuilderLike => [");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("new Test().m(it, new Long(0))");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("println(length)");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("]");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.io.Serializable;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.ObjectExtensions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Test<T extends Object> {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Object m(final T a, final T b) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static StringBuilderLike m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("StringBuilderLike _stringBuilderLike = new StringBuilderLike();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Procedure1<StringBuilderLike> _function = new Procedure1<StringBuilderLike>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public void apply(final StringBuilderLike it) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Test<Serializable> _test = new Test<Serializable>();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Long _long = new Long(0);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_test.m(it, _long);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("InputOutput.<Integer>println(Integer.valueOf(it.length()));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return ObjectExtensions.<StringBuilderLike>operator_doubleArrow(_stringBuilderLike, _function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testBug406425_03() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike");
    _builder.newLine();
    _builder.append("class Test {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def <T> m(T a, T b){}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def m() {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("new StringBuilderLike => [");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("m(it, new Long(0))");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("println(length)");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("]");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.io.Serializable;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.ObjectExtensions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Test {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Object> Object m(final T a, final T b) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public StringBuilderLike m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("StringBuilderLike _stringBuilderLike = new StringBuilderLike();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Procedure1<StringBuilderLike> _function = new Procedure1<StringBuilderLike>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public void apply(final StringBuilderLike it) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Long _long = new Long(0);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Test.this.<Serializable>m(it, _long);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("InputOutput.<Integer>println(Integer.valueOf(it.length()));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return ObjectExtensions.<StringBuilderLike>operator_doubleArrow(_stringBuilderLike, _function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testBug406425_04() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike");
    _builder.newLine();
    _builder.append("class Test {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def <T> m(T a, T b){}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def m() {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("new StringBuilderLike => [");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("it.m(new Long(0))");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("println(length)");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("]");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.io.Serializable;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.ObjectExtensions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Test {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Object> Object m(final T a, final T b) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public StringBuilderLike m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("StringBuilderLike _stringBuilderLike = new StringBuilderLike();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Procedure1<StringBuilderLike> _function = new Procedure1<StringBuilderLike>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public void apply(final StringBuilderLike it) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Long _long = new Long(0);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Test.this.<Serializable>m(it, _long);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("InputOutput.<Integer>println(Integer.valueOf(it.length()));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return ObjectExtensions.<StringBuilderLike>operator_doubleArrow(_stringBuilderLike, _function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testBug406425_05() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike");
    _builder.newLine();
    _builder.append("class Test {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def <T> m(T a, T b){}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def m() {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("new StringBuilderLike => [");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("m(new Long(0))");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("println(length)");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("]");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.io.Serializable;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.ObjectExtensions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Test {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Object> Object m(final T a, final T b) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public StringBuilderLike m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("StringBuilderLike _stringBuilderLike = new StringBuilderLike();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Procedure1<StringBuilderLike> _function = new Procedure1<StringBuilderLike>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public void apply(final StringBuilderLike it) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Long _long = new Long(0);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Test.this.<Serializable>m(it, _long);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("InputOutput.<Integer>println(Integer.valueOf(it.length()));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return ObjectExtensions.<StringBuilderLike>operator_doubleArrow(_stringBuilderLike, _function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testBug406425_06() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike");
    _builder.newLine();
    _builder.append("class Test {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def <T> m(T a, T b){}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def m() {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("newArrayList(new StringBuilderLike).forEach [");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("m(it, new Long(0))");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("println(length)");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("]");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.io.Serializable;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Consumer;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Test {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Object> Object m(final T a, final T b) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public void m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("StringBuilderLike _stringBuilderLike = new StringBuilderLike();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Consumer<StringBuilderLike> _function = new Consumer<StringBuilderLike>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public void accept(final StringBuilderLike it) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Long _long = new Long(0);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Test.this.<Serializable>m(it, _long);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("InputOutput.<Integer>println(Integer.valueOf(it.length()));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("CollectionLiterals.<StringBuilderLike>newArrayList(_stringBuilderLike).forEach(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testBug406425_07() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike");
    _builder.newLine();
    _builder.append("class Test {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def static <T> m(T a, T b){}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def m() {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("new StringBuilderLike => [");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("m(it, new Long(0))");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("println(length)");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("]");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.io.Serializable;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.ObjectExtensions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Test {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static <T extends Object> Object m(final T a, final T b) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public StringBuilderLike m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("StringBuilderLike _stringBuilderLike = new StringBuilderLike();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Procedure1<StringBuilderLike> _function = new Procedure1<StringBuilderLike>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public void apply(final StringBuilderLike it) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Long _long = new Long(0);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Test.<Serializable>m(it, _long);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("InputOutput.<Integer>println(Integer.valueOf(it.length()));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return ObjectExtensions.<StringBuilderLike>operator_doubleArrow(_stringBuilderLike, _function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testBug406425_08() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike");
    _builder.newLine();
    _builder.append("class Test {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def static <T> m(T a, T b){}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def static m() {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("new StringBuilderLike => [");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("m(it, new Long(0))");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("println(length)");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("]");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.io.Serializable;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.ObjectExtensions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Test {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static <T extends Object> Object m(final T a, final T b) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static StringBuilderLike m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("StringBuilderLike _stringBuilderLike = new StringBuilderLike();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Procedure1<StringBuilderLike> _function = new Procedure1<StringBuilderLike>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public void apply(final StringBuilderLike it) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Long _long = new Long(0);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Test.<Serializable>m(it, _long);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("InputOutput.<Integer>println(Integer.valueOf(it.length()));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return ObjectExtensions.<StringBuilderLike>operator_doubleArrow(_stringBuilderLike, _function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testBug406425_09() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike");
    _builder.newLine();
    _builder.append("class Test {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def <T> m(T a, T b){}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("    ");
    _builder.append("static def m() {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("newArrayList(new StringBuilderLike).forEach [");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("new Test().m(it, new Long(0))");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("println(length)");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("]");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.io.Serializable;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Consumer;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Test {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public <T extends Object> Object m(final T a, final T b) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("StringBuilderLike _stringBuilderLike = new StringBuilderLike();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Consumer<StringBuilderLike> _function = new Consumer<StringBuilderLike>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public void accept(final StringBuilderLike it) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Test _test = new Test();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Long _long = new Long(0);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_test.<Serializable>m(it, _long);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("InputOutput.<Integer>println(Integer.valueOf(it.length()));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("CollectionLiterals.<StringBuilderLike>newArrayList(_stringBuilderLike).forEach(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testBug406425_10() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike");
    _builder.newLine();
    _builder.append("class Test<T> {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def m(T a, T b){}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("    ");
    _builder.append("static def m() {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("newArrayList(new StringBuilderLike).forEach [");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("new Test().m(it, new Long(0))");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("println(length)");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("]");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.io.Serializable;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Consumer;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Test<T extends Object> {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public Object m(final T a, final T b) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("StringBuilderLike _stringBuilderLike = new StringBuilderLike();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Consumer<StringBuilderLike> _function = new Consumer<StringBuilderLike>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public void accept(final StringBuilderLike it) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Test<Serializable> _test = new Test<Serializable>();");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Long _long = new Long(0);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_test.m(it, _long);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("InputOutput.<Integer>println(Integer.valueOf(it.length()));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("CollectionLiterals.<StringBuilderLike>newArrayList(_stringBuilderLike).forEach(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void testBug406425_11() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike");
    _builder.newLine();
    _builder.append("class Test {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("static def <T> m(T a, T b){}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("    ");
    _builder.append("static def m() {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("newArrayList(new StringBuilderLike).forEach [");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("m(it, new Long(0))");
    _builder.newLine();
    _builder.append("            ");
    _builder.append("println(length)");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("]");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.io.Serializable;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Consumer;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.core.tests.compiler.StringBuilderLike;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Test {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static <T extends Object> Object m(final T a, final T b) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("return null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void m() {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("StringBuilderLike _stringBuilderLike = new StringBuilderLike();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Consumer<StringBuilderLike> _function = new Consumer<StringBuilderLike>() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("public void accept(final StringBuilderLike it) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Long _long = new Long(0);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Test.<Serializable>m(it, _long);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("InputOutput.<Integer>println(Integer.valueOf(it.length()));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("CollectionLiterals.<StringBuilderLike>newArrayList(_stringBuilderLike).forEach(_function);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }
}
